﻿using System.Web;
using SimpleInjector;
using SimpleInjector.Integration.Web;

namespace YuYuKiCms.Framework.DI
{
    public class HybridLifeStyle
    {
        private static Lifestyle _lifestyle;

        public static Lifestyle LifeStyle
        {
            get
            {
                return _lifestyle ?? (_lifestyle = Lifestyle.CreateHybrid(() => HttpContext.Current != null,
                    new WebRequestLifestyle(),
                    Lifestyle.Transient));
            }
        }
    }
}